// ==UserScript==
// @name          Fuck Qzone
// @description   Remove all tweets contain specified words.
// @include       http://user.qzone.qq.com/*
// @require       http://libs.baidu.com/jqmobi/1.0.0/jq.mobi.min.js
// ==/UserScript==

var words = [/exo粉/i, /tfboy/i, /bieber/i, /avril/i, /taylor/i, /kris/i, /belieber/i,
            "二次元", "三次元" ,"日本人", "中国人",
            "腐女", "黑塔利亚", "瓶邪", "盗墓笔记",
            "行星饭", "鹿晗", "吴世勋", "金秀贤",
            "王俊凯", "王源", "易烊千玺", "四叶草",
            "小时代", "林萧", "顾里", "南湘",
            "唐宛如", "顾源", "宫洺", "卫海",
            "陈学冬", "李易峰", "张起灵", "吴邪",
            "柯震东", "房祖名", "陈奕迅", "吴亦凡",
            "艾薇儿", "贾斯汀比伯", "暖男", "权志龙",
            "占领中环", "占中", "香港人",
            " 　　　　安泽熙　　 　　 "];

(function (words) {
    var o = function(words) {
        var tweets = jq('.f-single');
        "finlist" in window || (window.finlist = {});
        for (var i=0; i<tweets.length; i++) {
            if (tweets[i].childNodes[0].id in window.finlist) {
                continue;
            }
            for (var j=0; j<words.length; j++) {
                if (tweets[i].innerHTML.search(words[j]) >= 0) {
                    var z = tweets[i].innerHTML;
                    var r = Math.random();
                    var q = Math.random();
                    tweets[i].innerHTML = "<div onclick='$(\"" + q +"\").innerHTML = $(\"" + r +"\").innerHTML;this.style.height=\"\";this.style.lineHeight=\"\";this.style.textAlign=\"\";this.onclick=\"\"' style='height:64px;line-height:64px;text-align:center;' id='" + q + "'>被屏蔽说说<div style='display:none;' id='" + r + "'>" + z + "</div></div>";
                    window.finlist[q] = true;
                    break;
                }
            }
        }
    };

    o(words);
    var observer = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
    var b = new observer(function () {
        o(words);
    });
    var l = jq('.fn-feed-container');
    for (var p=0; p<l.length; p++) {
        b.observe(l[p], {'childList': true, 'characterData': true, 'subtree': true});
    }
})(words);
